import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter);
// 访问链接
const routes = [
    {
        path: '/index',
        name: 'index',
        component: ()=> import("../views/index.vue"),
        meta: {
            title: '融资融券'
        }
    },
    {
        path: '/levelPage/:type',
        name: 'levelPage',
        component: ()=> import("../views/twoLevelPage.vue"),
        meta: {
            title: '两市交易总量'
        }
    },
    {
        path: '/transationPage/:market/:type',
        name: 'transationPage',
        component: ()=> import("../views/transationPage.vue"),
        meta: {
            title: '两市交易明细'
        }
    },
];
const router = new VueRouter({
    linkActiveClass: 'active',
    base: process.env.BASE_URL,
    routes
});
//路由后置钩子
router.afterEach((to, from) => {
    //设置头部标题
    if (to.meta.title) document.title = to.meta.title;
});
export default router

